package com.rui.study.algorithm.T_调度任务的取消;

import com.rui.study.algorithm.BinarySearch_1_二分查找.BinarySearch1;
import com.rui.study.algorithm.BinarySearch_2_二分查找变体之第一个指定的值.BinarySearch2;
import com.rui.study.algorithm.BinarySearch_3_二分查找变体之最后一个指定的值.BinarySearch3;
import com.rui.study.algorithm.BinarySearch_4_二分查找变体之第一个大于等于指定值.BinarySearch4;
import com.rui.study.algorithm.BinarySearch_5_二分查找变体之最后一个小于等于指定值.BinarySearch5;
import com.rui.study.algorithm.PrintUtil;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2018-11-12 14:21
 **/
public class BinarySearchTestUtil {

    static int[] a0 = {0, 1, 2, 3, 4, 5, 5, 5, 5, 5};
    static int[] a1 = {0, 5, 5, 5, 6, 7, 8, 9, 9, 9};
    static int[] a2 = {5, 5, 5, 5, 6, 7, 8, 9, 9, 9};
    static int[] a3 = {0, 1, 2, 3, 4, 6, 7, 8, 9, 9};
    static int[] a4 = {0, 0, 0, 0, 0, 0, 1, 2, 3, 4};
    static int[] a5 = {6, 7, 8, 9, 9, 9, 9, 9, 9, 9};
    static int[] a6 = {0, 1, 2, 3, 4, 4, 5, 7, 8, 9};

    private static void testBinarySearch1() {
        PrintUtil.print(BinarySearch1.search(a0, 5));
        PrintUtil.print(BinarySearch1.search(a1, 5));
        PrintUtil.print(BinarySearch1.search(a2, 5));
        PrintUtil.print(BinarySearch1.search(a3, 5));
        PrintUtil.print(BinarySearch1.search(a4, 5));
        PrintUtil.print(BinarySearch1.search(a5, 5));
        PrintUtil.print(BinarySearch1.search(a6, 5));
    }

    private static void testBinarySearch2() {
        PrintUtil.print(BinarySearch2.search(a0, 5));
        PrintUtil.print(BinarySearch2.search(a1, 5));
        PrintUtil.print(BinarySearch2.search(a2, 5));
        PrintUtil.print(BinarySearch2.search(a3, 5));
        PrintUtil.print(BinarySearch2.search(a4, 5));
        PrintUtil.print(BinarySearch2.search(a5, 5));
        PrintUtil.print(BinarySearch2.search(a6, 5));
    }

    private static void testBinarySearch3() {
        PrintUtil.print(BinarySearch3.search(a0, 5));
        PrintUtil.print(BinarySearch3.search(a1, 5));
        PrintUtil.print(BinarySearch3.search(a2, 5));
        PrintUtil.print(BinarySearch3.search(a3, 5));
        PrintUtil.print(BinarySearch3.search(a4, 5));
        PrintUtil.print(BinarySearch3.search(a5, 5));
        PrintUtil.print(BinarySearch3.search(a6, 5));
    }

    private static void testBinarySearch4() {
        PrintUtil.print(BinarySearch4.search(a0, 5));
        PrintUtil.print(BinarySearch4.search(a1, 5));
        PrintUtil.print(BinarySearch4.search(a2, 5));
        PrintUtil.print(BinarySearch4.search(a3, 5));
        PrintUtil.print(BinarySearch4.search(a4, 5));
        PrintUtil.print(BinarySearch4.search(a5, 5));
        PrintUtil.print(BinarySearch4.search(a6, 5));
    }

    private static void testBinarySearch5() {
        PrintUtil.print(BinarySearch5.search(a0, 5));
        PrintUtil.print(BinarySearch5.search(a1, 5));
        PrintUtil.print(BinarySearch5.search(a2, 5));
        PrintUtil.print(BinarySearch5.search(a3, 5));
        PrintUtil.print(BinarySearch5.search(a4, 5));
        PrintUtil.print(BinarySearch5.search(a5, 5));
        PrintUtil.print(BinarySearch5.search(a6, 5));
    }

    public static void main(String[] args) {
        testBinarySearch5();
    }

}
